<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>

<body>
    <script type="text/javascript">
        Vue.config.productionTip = false  //阻止 vue 在启动时生成生产提示。
    </script>

    <div id="root">

        <div>姓名：{{name}}</div>

    </div>

</body>

<script type="text/javascript">

    let number = 24;
    let person = {
        name: '李四',
        sex: '男'
    }
    //再定义一个属性
    Object.defineProperty(person, 'age', {
        get() {
            return number;
        },//getter函数，获取到该属性的值，所以必须设置返回值return
        set(newValue){
            number = newValue;
        },//setter函数，设置该属性的值，所以必须传入一个新的值
    })
    console.log("person", person)
    //枚举所有的属性
    console.log("枚举所有的属性：", Object.keys(person))






    const vm = new Vue({
        el: '#root',
        data: {
            name: "张三",
        }
    });
</script>

</html>